jQuery.extend($.fn.fmatter , {
    imageFmatter : function(cellvalue, options, rowdata) {
        //return "$"+cellvalue;
        console.log(cellvalue)
        return "<img class=\"smm-picto\" src=\""+ cellvalue +"\" />";
    }
});

jQuery.extend($.fn.fmatter.imageFmatter , {
    unformat : function(cellvalue, options) {

        return cellvalue;
        //return cellvalue.replace("$","");
    }
});

function imageElem (value, options) {

    //TODO откуда брать value?

    var el = document.createElement("img");
    el.class = "popup-img";
    el.src = getSelectedCellImageSrc();

    return el
}

function imageValue(elem, operation, value) {

    if(operation === 'get') {
        return $(elem).attr('src')

    } else if(operation === 'set') {

        setTimeout(function(){
            var src = getSelectedCellImageSrc()

            $(elem).attr('src',src)
        },2000)



    }
}

function getSelectedCellImageSrc(){
    var name = $('input[name=grid_name]').val();
    var grid = jQuery('#' + name);
    var sel_id = grid.jqGrid('getGridParam', 'selrow');

    var src = $('tr[id='+sel_id+']').find('img').attr('src');

    return src
}